﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/AdminMasterPage.master" AutoEventWireup="true"
    CodeBehind="CreateUser.aspx.cs" Inherits="TuyenDungViecLam.Admin.CreateUser" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder4" runat="server">
    <div class="art-Block">
        <div class="art-Block-tl">
        </div>
        <div class="art-Block-tr">
        </div>
        <div class="art-Block-bl">
        </div>
        <div class="art-Block-br">
        </div>
        <div class="art-Block-tc">
        </div>
        <div class="art-Block-bc">
        </div>
        <div class="art-Block-cl">
        </div>
        <div class="art-Block-cr">
        </div>
        <div class="art-Block-cc">
        </div>
        <div class="art-Block-body">
            <div class="art-BlockHeader">
                <div class="art-header-tag-icon">
                    <div class="t">
                        Tạo User</div>
                </div>
            </div>
            <div class="art-BlockContent">
                <div id="divCapnhat" runat="server">
                    <%--<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true">
            </asp:ScriptManager>--%>
                    <div class="label_register">
                        <asp:Label ID="Label1" runat="server" Text="Label" AssociatedControlID="txtUsername"> UserName:</asp:Label>
                    </div>
                    <div class="textbox_register">
                        <asp:TextBox ID="txtUsername" CssClass="tb_2" Width="200px" runat="server" onkeyup="usernameChecker(this.value);"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtUsername"
                            ErrorMessage="*"></asp:RequiredFieldValidator>
                        <span id="spanAvailability"></span>
                    </div>
                    <div class="label_register">
                        <asp:Label ID="Label2" runat="server" Text="Label"> Password:</asp:Label>
                    </div>
                    <div class="textbox_register">
                        <asp:TextBox ID="txtPassword" CssClass="tb_2" Width="200px" runat="server" TextMode="Password"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="txtPassword"
                            ErrorMessage="*"></asp:RequiredFieldValidator>
                    </div>
                    <div class="label_register">
                        <asp:Label ID="Label13" runat="server" Text="Label"> xác nhận lại Password:</asp:Label>
                    </div>
                    <div class="textbox_register">
                        <asp:TextBox ID="txtXacNhanPassword" CssClass="tb_2" Width="200px" runat="server"
                            TextMode="Password"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="txtXacNhanPassword"
                            ErrorMessage="*"></asp:RequiredFieldValidator>
                        <asp:CompareValidator ID="CompareValidator1" runat="server" ControlToCompare="txtPassword"
                            ControlToValidate="txtXacNhanPassword" ErrorMessage="xác nhận mật khẩu không đúng"></asp:CompareValidator>
                    </div>
                    <div class="label_register">
                        <asp:Label ID="Label7" runat="server" Text="Label"> Email:</asp:Label>
                    </div>
                    <div class="textbox_register">
                        <asp:TextBox ID="txtEmail" Width="200px" CssClass="tb_2" runat="server"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server" ControlToValidate="txtEmail"
                            ErrorMessage="*"></asp:RequiredFieldValidator>
                        <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="txtEmail"
                            ErrorMessage="Emai không hợp lệ" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"></asp:RegularExpressionValidator>
                    </div>
                    <div class="label_register">
                        <asp:Label ID="Label5" runat="server" Text="Label"> Chọn:</asp:Label>
                    </div>
                    <div class="textbox_register">
                        <asp:RadioButton ID="RbNguoiTimViec" runat="server" GroupName="chon" Text="Người Tìm Việc" />
                        <asp:RadioButton ID="RbNhaTuyenDung" runat="server" GroupName="chon" Text="Nhà Tuyển Dụng" />
                    </div>
                    <div class="textbox_register">
                        <asp:CheckBox ID="CbActiveUser" runat="server" />
                        <asp:Label ID="Label3" runat="server" Text="Label"> Kích hoạt User</asp:Label>
                    </div>
                    <div class="label_register">
                        <asp:Label ID="Label4" runat="server" Text="Label"> Chọn Role cho User</asp:Label>
                    </div>
                    <div class="textbox_register">
                        <asp:CheckBoxList ID="CblAddRoleForUser" runat="server">
                        </asp:CheckBoxList>
                        <br />
                        <asp:Label ID="lblMessage" runat="server" ForeColor="Red"></asp:Label>
                    </div>
                    <div class="textbox_register">
                        <asp:Button ID="BtCreateUser" runat="server" Text="Tạo User" CssClass="button" OnClick="BtCreateUser_Click" />
                    </div>

                    <script type="text/javascript">
                        var usernameCheckerTimer;
                        var spanAvailability = $get("spanAvailability");

                        function usernameChecker(username) {
                            clearTimeout(usernameCheckerTimer);
                            if (username.length == 0)
                                spanAvailability.innerHTML = "";
                            else {
                                spanAvailability.innerHTML = "<span style='color: #ccc;'>checking...</span>";
                                usernameCheckerTimer = setTimeout("checkUsernameUsage('" + username + "');", 750);
                            }
                        }

                        function checkUsernameUsage(username) {
                            // initiate the ajax pagemethod call
                            // upon completion, the OnSucceded callback will be executed
                            PageMethods.IsUserAvailable(username, OnSucceeded);
                        }

                        // Callback function invoked on successful completion of the page method.
                        function OnSucceeded(result, userContext, methodName) {
                            if (methodName == "IsUserAvailable") {
                                if (result == true)
                                    spanAvailability.innerHTML = "<span style='color: DarkGreen;'>Available</span>";
                                else
                                    spanAvailability.innerHTML = "<span style='color: Red;'>Unavailable</span>";
                            }
                        }
                    </script>

                </div>
                <div id="divThongbao" runat="server" visible="false" style="text-align: center">
                    <asp:Label ID="lbThongbao" runat="server" Text="" Font-Size="24"> </asp:Label>
                    <br />
                    <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="~/Admin/CreateUser.aspx">Back</asp:HyperLink>
                </div>
            </div>
        </div>
    </div>
</asp:Content>
